# CODING OPTIONS

InitialCalls
# Initial function calls (or other brief C
InitialCalls
# statements) to put at front of main program.
InitialCalls
# E.g.: InitialCalls setup_buffer()

ExpandIncludes
# 1 or default=expand include files into output

# 0=convert Pascal include to #include

CollectNest # 1 or default=collect sub-procs, emit at end.

# 0=emit sub-procedures one by one; this will

#
produce bad code but is useful with

#
ExpandIncludes=0.

ShortCircuit
# 1=use &&, 0=use & for boolean AND, also OR.

# default=1 for Turbo/HP-UX, 0 for HP Pascal

#
may be overridden by $B / $partial_eval$

ShortOpt
# 1 or default=optimize a&b to a&&b if equiv

# 0=always use a&b, depending on ShortCircuit

ElimDeadCode
# 1 or default=eliminate unreachable code

# 2=even eliminate "if (false)" statements

# 0=leave unreachable code in place

AnalyzeFlow

# 1 or default=perform data flow analysis

# 0=make no assumptions based on data flow

FoldConstants
# 1=instantiate non-structure const's in-line

#
(applies to int, char, boolean, enum, real)

# 0 or default=use #define's for constants

# 0 causes constant to be completely symbolic;

# default sometimes instantiates if convenient.

# A constant is folded if FoldConstants=1

# either when the const was defined, or when

# it was referenced.

FoldStrConstants
# 1=instantiate string const's in-line, as above

# 0 or default=use #define's for string const's

CharConsts
# 1 or default=const a='X' => #define a 'X'

# 0=const a='X' => #define a "X"

# (either always works---aesthetic only)

UseConsts
# 1=use "const" keyword in C

# 2=use "Const" form even if UseAnyptrMacros=0

# 0=do not use "const" declarations

# default=1 if AnsiC=1 or C++=1

UseUndef
# 1=use "#undef" when #defines go out of scope

# 0=do not use "#undef", default=1.

UseInits                        # 1=use "int x = 5" instead of "int x; x = 5"
                                # 2=use "int x = a" for non-constant "a"
                                # 3=use inits throughout body, a la C++
                                # 4=use multiple inits in "if" branches, etc.
                                # 0=do not convert assignments to initializers
                                # default=4 if C++=1, 1 otherwise

StoreFileNames
# 1=store file names associated with file vars

# 0=let the system record the name

# default=1 in Turbo Pascal, 0 otherwise.

SqueezeSubr # 1 or default=squeeze subranges into char, etc.

# 0=use only short's and int's (or long's).

UseEnum # 1=use C "enum" types

# 0=use integers for enumerations

# default=1 unless AnsiC=0

SqueezeEnum # 1=use bytes for small enums, when UseEnum=0

# 0=use shorts always

# default=0 for HP Pascal, 1 otherwise.

CompEnums
# 1=okay to compare enums directly

# 0=cast enums to ints for comparisons

# default=0 unless AnsiC=1.

PreserveTypes
# 1 or default=use typedef for all Pascal types

# 0=don't unnecessarily use typedef

# (Can be turned on/off for different decls)

PreservePointers
# 1=override PreserveTypes for pointer types

# 0 or default=use in-line "*" notation

# -1=same as PreserveTypes

PreserveStrings # 1=override PreserveTypes for string types

# 2=use typedef for strings w/non-const lengths

# 0=use in-line "[]" notation for strings

# -1 or default=same as PreserveTypes

Packing # 1 or default=fully packed records and arrays

# 0=ignore "packed" keyword

# 2=pack to bytes, but not bits

PackSigned
# 1=implement packed arrays of signed values

# 0=only pack unsigned arrays

# default=1

SkipIndices # Number of vacant array indices allowable,

# default 0.
If 1, then array [1..10] is

# converted to array [11], but array [2..10]

# would be converted as array [9] with offsets.

OffsetForLoops
# 1=adjust loops where index is always used

#
as, e.g., i-1 by offsetting the index.

# 0=leave them alone.
Default=1.

ForEvalOrder
# 1=in for x:=y to z, force eval of y before z.

# 0 or default=evaluation order unimportant.

StringLeaders
# Number of leading '>' placeholder characters

# that can be prepended to a string literal.

# Default is 3.

StringCeiling
# Maximum size for strings. Default is 255.

# If > 255, allows some "slop" in strings.

# If < 255, shortens large strings.

StringDefault
# Size of string declared without [ ] brackets.

# Default is 255.

StringTruncLimit
# Minimum size of strings for which a warning

# is generated when assigned possibly longer

# strings.
These are assignments to check if

# Turbo-like truncation is necessary.

# Default is 80 for Turbo, 0 otherwise.

LongStringSize
# Smallest string which can be considered

# "arbitrarily long"; default=StringCeiling.

KeepNulls
# 1=try to preserve null (#0) chars in strings

# 0 or default=ignore them (but warn)

HighCharBits
# 1=convert "ch >= 128" to "(ch & ~127) != 0"

# 2=convert "ch >= 128" to "(ch & 128) != 0"

# 0=do not use bit ops for high characters

# default=1 only if ch's signed-ness is unknown

StaticFunctions # 1 or default=use "static" for private funcs

# 0=don't create static functions

StaticVariables # 1 or default=use "static" for private vars

# 0=don't create static global vars

NeedStatic                      # Names of functions or variables which
NeedStatic                      # need to be declared static despite
NeedStatic                      # StaticFunctions=0 or StaticVariables=0.

AlwaysCopyValues
# 1=always make a local copy of a parameter

# 0 or default=only if it appears to be changed

VoidArgs
# 1=write "f(void)" for funcs with no args

# 0=write "f()" for funcs with no args

# default=depends on AnsiC and C++

Prototypes
# 1=write "f(int a, int b)"

# 2=write "f(int, int)" when possible

# 0=write "f(a, b) \n int a, b;"

# default=depends of AnsiC and C++

FullPrototyping # 1 or default=use prototypes everywhere

# 0=use prototypes only for forward/extern

ProcPtrPrototypes
# 1 or default=use prototypes for C func ptrs

# 0=always write, e.g., int (*fp)();

CastArgs
# 1=include argument casts if needed: (double)i

# 0=do not include argument casts (dangerous!)

# default=do not cast if func has a prototype

CastLongArgs
# 1=include int/long argument casts if needed

# 0=do not cast between int and long

# default=follow CastArgs

PromoteArgs # 1=promote e.g. short to int in prototypes

# 0=do not promote in prototypes

# default=only when prototyping forwards only

FixPromotedArgs # 1=attempt to handle "&" of promoted args

# 2=warn in this case but do not try to fix

# 0=leave promoted args alone

# default=1

PromoteEnums
# 1=promote enum to int when promoting args

# 0=leave enums alone in prototypes

# default=only when UseEnum=0

StaticLinks # 1=use _PROCEDURE (ProcTypeName) for proc ptrs

# 2=use _PROCEDURE but assume only global procs

# 0=use C function pointers, no static links

# default=1 in HP, 0 in Turbo Pascal

VarStrings
# 1=full support for "var s:string" params

#
and HP Pascal's strmax function

# 0=assume all var s:string's are string[255]

# default=0 always; may need 1 for some

#
HP Pascal programs

VarFiles
# 1 or default="var f : file" params use &

# 0=pass FILE *'s by value; must not open or

#
close the file within the procedure

UseRefs                         # 1=use C++ "int &x = y" when appropriate.
                                # 0=use C "int *x = &y".
                                # default=1 if C++=1, 0 otherwise

AddrStdFiles
# 1=okay to write "&stdout", etc.

# 0 or default=not okay

CopyStructFuncs # 1=write "temp = f(); temp.field"

# 0=write "f().field"

# default=1 unless AnsiC=1

Atan2
# 1=convert arctan(a/b) to atan2(a,b)

# 0 or default=convert it to atan(a/b)

BitwiseMod
# 1 or default=convert x mod 16 to x&15

# 0=convert x mod 16 to x%16

BitwiseDiv
# 1=convert x div 16 to x>>4

# 0 or default=convert x div 16 to x/16

AssumeBits
# 1=assume args of funcs like na_po2 are

#
within reasonable range; write 1<<x.

# 0 or default=no assumptions; write na_po2

AssumeSigns # 1 or default=for e.g. na_lsl, assume

#
"x" is positive, "-x" is negative.

# 0=no assumptions (except for constants!)

NewDelete

# 1=use C++ "new" and "delete"

# 0=use C "malloc" and "free"

# default=1 if C++=1, 0 otherwise

AllocZeroNil
# 1=na_new(p,0) must set p to nil

# 0 or default=not necessary

# 2=not necessary, but print a warning

PrintfOnly
# 1=don't use puts, putc, etc., in WRITE

# 0=use puts, etc., as well as printf

# default=a pleasing compromise

MixWritelns # 1 or default=writeln;writeln=>printf("\n\n")

# 0=don't mix consecutive writeln stmts

MessageStderr

# 1 or default="message" writes to stderr

# 0="message" is exactly like "writeln"

IntegerWidth
# Default field width for writing integers.

# Default is 1 for Turbo, 12 for HP.

RealWidth
# Default field width for writing reals.

# Default is 12.

FormatStrings
# 1=full support for write(string:width)

# 0 or default=':width' only stretches

WhileFgets
# 1 or default=while (fgets(...))  ... 

# 0=while (!eof(...))  fgets(...); ... 

UseGets # 1 or default=use gets to read string[255]

# 0=always use fgets (with length checking)

FloatScanfCode                  # Name of scanf control string for floats.
                                # Default is "%g".

NewLineSpace
# 1=convert \n to ' ' in read(ch)

# 0=leave newlines alone reading characters

# default=0 in Turbo Pascal, 1 otherwise

BuildReads
# 1=combine x:=f^;get(f) into read(f,x)

# 2=only for text files and files of char

# 0=leave it alone; default=1

BuildWrites # 1=combine f^:=x;put(f) into write(f,x)

# 2=only for text files and files of char

# 0=leave it alone; default=1

BinaryMode
# 1 or default=fopen binary files as, say, "rb"

# 0=fopen binary files as "r"

# 2=fopen binary files as "r" with a warning

ReadWriteOpen
# 1=RESET/REWRITE open binary files read/write

# 0=RESET opens read-only, REWRITE write-only

# 2=Open all files (text and binary) read/write

# default=1 in Turbo, 0 otherwise.

OpenMode
# fopen mode string to use for Pascal open

# statement.
Use a+ if that mode allows

# seeking.
Default=build out of ANSI modes

FileNameFilter
# Name of a function to call which converts

# a file name into a form usable by fopen;

# if name must be changed this should return

# a pointer to a static buffer.

# Not used for constant names.
"0"=no filter.

# default=P_trimname for Oregon/Berk, else 0

LiteralFiles
# 0=nameless rewrite(f) generates a temp file

# 1=nameless rewrite(f) uses "f" as file name

# 2=like 1 only if f appeared in "program" stmt

# default=2 for Berkeley, else 0.

LiteralFile # A file variable which should be treated as
LiteralFile # if LiteralFiles=1.
If LiteralFiles=2, files
LiteralFile # in program header are added to this list.

StructFiles # 1="file of x" produces a struct with buffer

#
and file-name included.

# 0 or default=use native FILE *'s, with

#
extra variables to hold buffer and name.

StructFile
# A file variable which should be treated as
StructFile
# if StructFiles=1.

FullStrWrite
# 1=full implementation of strwrite(s,i,j,...)

# 0=ignore "j" variable and other issues

# default=assign "j", assume not mid-string

# 2=like default, but issue a warning

FullStrRead # 1 or default=full impl of strread using "%n"

# 0=fake the value of "j"

# 2=like default, but issue a warning

SetBits # Number of bits to use in each "long" of a set

# default=LongSize if defined, else 32

DefaultSetSize
# Default size of un-typed set constants;

# default default=256 for VAX, else 8192

SmallSetConst
# 0=write small-set literals like "1<<2|1<<4"

# 1=write them like "0x14"

# 2=write them like "20"

# -1=do not use small-sets at all

# default=-1 if SetBitsName defined, else 1

BigSetConst # (analogous to SmallSetConst for big sets)

LeLeRange
# 1=write "j in [1..10]" as "1<=j && j<=10"

# 0 or default=write ... as "j>=1 && j<=10"

UnsignedTrick
# 1 or default=write "(unsigned)i <= 10"

# 0=leave "i >= 0 && i <= 10" alone

UseIsAlpha
# 1 or default=use "isalpha", "isdigit", etc.

# 0=use plain comparisons

UseIsSpace
# 1=convert "c==' '" to "isspace(c)"

# 0 or default=leave it alone

UseStrncmp
# 1=use strncmp to compare packed array of char

# 0=use memcmp, same as for all other arrays

# default=1